import velocity from 'velocity-animate'

const animation = {
  enter(el, done) {
    var self = this;
    velocity(
      el, {
        height: self.bodyHeight + "px",
        opacity: 1,
      }, {
        duration: 200,
        complete: done
      }
    );
  },
  beforeLeave(el, done) {
    this.bodyHeight = el.clientHeight;
  },
  leave(el, done) {
    el.style.height = el.clientHeight + "px";
    velocity(el, {
      height: "0px",
      opacity: 0,
    }, {
      duration: 200,
      complete: done
    });
  },
}

export default animation
